/**
 * Created by zhangdi on 2020/12/16 10:44:31.
 */
public class app {
    public static void main(String[] args) {
        double[] taDous ={10225.5d,108d,39d,0.01d,7.2d,7.44d,0.03d,315.43d,7.2d,6.34d,1.51d, 39d, 69d, 39d, 78d,0.01d,39d, 69d, 69d, 9.5d, 913.37d, 268.84d, 15.5d};
        diguiSum(taDous,10225.5d);

    }

    static double[] diguiSum(double[] array,double sum) {
        for (double v : array) {

        }
        return null;
    }

    // 递归求结果
    static double[] cir(int ceng, int cengQuit, int startPiont, double[] array, double[] cache, double sum) {
        ceng++;
        for (int i = startPiont; i < array.length; i++) {
            cache[ceng] = array[i];
            if (ceng == cengQuit) {
                if (getSum(cache) == sum) {
                    printcache(cache);
                    //return cache;
                }
                if (getSum(cache) > sum) {
                    break;
                }
            }
            if (ceng < cengQuit) {
                startPiont = i + 1;
                cir(ceng, cengQuit, startPiont, array, cache,sum);
            }
        }
        return null;
    }

    // 获取组合数字之和
    static double getSum(double[] cache) {
        double sum = 0.0;
        for (int i = 0; i < cache.length; i++) {
            sum = sum + cache[i];
        }
        return sum;
    }

    // 打印组合的可能
    static void printcache(double[] cache) {
        for (int i = 0; i < cache.length; i++) {
            System.out.print(cache[i] + ",");
        }
        System.out.println();
    }
}
